<?php

/**
 * 微信公众号
 * @author iJoggers.com
 */
class WeixinPub
{
    /**
     * AppID
     * @var string
     */
    public $appId = 'wx6e9f935be224ef2e';

    /**
     * Secret
     * @var string
     */
    public $key = 'fda90d889cf846234720ee5d414a336c';

    public function getWxConfig()
    {
        $config = [];

        require(FILE . 'lib/weixinJssdk.php');

        $js = new JSSDK($this->appId, $this->key);
        $signPackage = $js->GetSignPackage();

        if($signPackage)
        {
            $config = [
                'appId' => $this->appId,
                'timestamp' => $signPackage['timestamp'],
                'nonceStr' => $signPackage['nonceStr'],
                'signature' => $signPackage['signature'],
                'jsApiList' => ['onMenuShareTimeline', 'onMenuShareAppMessage'],
            ];
        }

        return $config;
    }
}